<html>
<head><meta charset="utf-8"><title>yield safe lint · wg-async-foundations · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/index.html">wg-async-foundations</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html">yield safe lint</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196353786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196353786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196353786">(May 05 2020 at 19:20)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> by the way I am super interested in trying to champion the yield safe lint but not sure what you see as being the next steps. I'd be happy to write an RFC etc.</p>



<a name="196353853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196353853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196353853">(May 05 2020 at 19:21)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> I think an RFC is indeed probably the next step.</p>



<a name="196353916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196353916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196353916">(May 05 2020 at 19:21)</a>:</h4>
<p>It seems like "pretty popular" idea, I think the main question would be figuring out the niggly details</p>



<a name="196353994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196353994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196353994">(May 05 2020 at 19:22)</a>:</h4>
<p>in particular, the question I raised about <code>#[must_use]</code></p>



<a name="196354045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196354045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196354045">(May 05 2020 at 19:22)</a>:</h4>
<p>I think the combination though of being able to lint for "types that should not be live across an await" and "things that should not be used in an async context" seems pretty darn useful</p>



<a name="196354074"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196354074" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196354074">(May 05 2020 at 19:22)</a>:</h4>
<p>not sure if those are two distinct lints or attributes or not</p>



<a name="196354272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196354272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196354272">(May 05 2020 at 19:24)</a>:</h4>
<p>Yup, agreed, I will start collecting some info around this, I am pretty busy for the next week or so but should have time later in may to get something hammered out.</p>



<a name="196354318"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196354318" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196354318">(May 05 2020 at 19:25)</a>:</h4>
<p>I am a bit cautious about the second lint since I think that one is much more questionable and not clear on exactly what attributes it should live on. But I think the yield safe one is a good start.</p>



<a name="196355376"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196355376" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196355376">(May 05 2020 at 19:32)</a>:</h4>
<p>Yeah, one problem I see with the second one is that it might not be as effective</p>



<a name="196356324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196356324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196356324">(May 05 2020 at 19:39)</a>:</h4>
<p>Its one of those things that is good to lean on if everything uses it but if only some have it and some don't then it may not work as well. Another interesting case is <code>sleep</code> can technically be totally fine if say its less than a few ms while any delays that are longer would be problematic.  This then also depends per executor and use case. Since, blocking varies so much it may not be worth it to invest right now.</p>



<a name="196356418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196356418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196356418">(May 05 2020 at 19:40)</a>:</h4>
<p>Another example would be <code>&lt;TcpStream as Read&gt;::read</code> with <code>set_nonblocking(true)</code> is also totally fine in an async context while in blocking mode would be an issue. So somehow that invariant would need to be encoded into the lint and that sounds hard.</p>



<a name="196356516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/196356516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#196356516">(May 05 2020 at 19:40)</a>:</h4>
<p>sounds good to leave off then, agreed</p>



<a name="202117238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/202117238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#202117238">(Jun 26 2020 at 17:13)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> sorry for the delay, <span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> and I want to pick this up. Do you still think its something viable? If so will start drafting some sort of RFC next week. Would love to know what you think the proper next steps are.</p>



<a name="202123375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/202123375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#202123375">(Jun 26 2020 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> yeah!</p>



<a name="202123437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/202123437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#202123437">(Jun 26 2020 at 18:10)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> feel free to post a draft of the RFC to the repo if you want to iterate there</p>



<a name="202123461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/202123461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#202123461">(Jun 26 2020 at 18:11)</a>:</h4>
<p>I can also add you as a member to the WG, so you have write access</p>



<a name="202137709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/202137709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#202137709">(Jun 26 2020 at 20:18)</a>:</h4>
<p>Yeah, that works, hopefully can get a draft going next week :)</p>



<a name="203303962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/203303962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#203303962">(Jul 08 2020 at 18:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> hey, do you have any reference docs on how locals get captured with generators? I think that could be useful for the RFC</p>



<a name="203305106"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/203305106" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#203305106">(Jul 08 2020 at 18:34)</a>:</h4>
<p>also just opened a draft PR around the lint, would love any feedback, we will continue working on this next week. <a href="https://github.com/rust-lang/wg-async-foundations/pull/16">https://github.com/rust-lang/wg-async-foundations/pull/16</a></p>



<a name="203305259"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/203305259" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#203305259">(Jul 08 2020 at 18:36)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> I may be biased but I think my blog post might be the best resource right now, at least I don’t know of any others :) <a href="https://tmandry.gitlab.io/blog/posts/optimizing-await-2/">https://tmandry.gitlab.io/blog/posts/optimizing-await-2/</a></p>



<a name="203861810"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/203861810" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#203861810">(Jul 14 2020 at 17:25)</a>:</h4>
<p>Figured :) my fav blog post</p>



<a name="204244188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204244188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204244188">(Jul 17 2020 at 18:50)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> looks like I cannot change the name of a stream, but I'll leave that to you. <span class="user-mention" data-user-id="116009">@nikomatsakis</span> I would love to hear your thoughts on this:</p>
<p>I’m not entirely sure about why the <code>must_not_await</code> can’t be a marker trait. It’s very much similar to <code>UnwindSafe</code> in that both are markers to signify the presence of logic invariants being broken if the thing they are warning about occurs. The only difference I see is how a <code>UnwindSafe</code> type composes with other types, namely:</p>
<blockquote>
<p>and it is also structurally composed (e.g., a struct is unwind safe if all of its components are unwind safe)</p>
</blockquote>
<p>While a <code>#[must_not_await]</code> would have the behavior “a struct is MustNotAwait if any one of its components is MustNotAwait”, though this might change with polonious.</p>
<p>Overall the arguments for an attribute are: 1) Best effort, might not always get everything, 2) Similar to the <code>#[must_use]</code> lint. I’m not entirely convinced that they are strong enough arguments.</p>



<a name="204244278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204244278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204244278">(Jul 17 2020 at 18:51)</a>:</h4>
<p>Separately, do you know the rationale behind why <code>UnwindSafe</code> is a trait and not an attribute? I couldn't find any RFCs for that.</p>



<a name="204244760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204244760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204244760">(Jul 17 2020 at 18:55)</a>:</h4>
<p>(deleted)</p>



<a name="204244786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204244786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204244786">(Jul 17 2020 at 18:55)</a>:</h4>
<p>oops, wrong thread</p>



<a name="204244866"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204244866" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204244866">(Jul 17 2020 at 18:56)</a>:</h4>
<p><code>UnwindSafe</code> is a trait because it gets used as a bound in an API, e.g. <a href="https://doc.rust-lang.org/stable/std/panic/fn.catch_unwind.html">https://doc.rust-lang.org/stable/std/panic/fn.catch_unwind.html</a></p>



<a name="204245010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204245010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204245010">(Jul 17 2020 at 18:56)</a>:</h4>
<p>there is nowhere to write a bound for "can be used across an await", even if we had done this before stabilization</p>



<a name="204245442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204245442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204245442">(Jul 17 2020 at 19:00)</a>:</h4>
<p>(did we discuss making the lint "transitive" btw? e.g. if you have a <code>MutexGuard</code> in some other struct? doesn't seem like it would come up often, might be useful, but I'm really not sure)</p>



<a name="204246041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204246041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204246041">(Jul 17 2020 at 19:05)</a>:</h4>
<p>Yeah me and <span class="user-mention" data-user-id="207781">@Lucio Franco</span> have discussed it a bit, <span class="user-mention" data-user-id="116009">@nikomatsakis</span> also brought it up, and I think the idea is that it is probably a good idea to make it transitive and that <code>#[must_use]</code> must also have the same behavior.</p>



<a name="204246081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204246081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204246081">(Jul 17 2020 at 19:05)</a>:</h4>
<p>And yeah, I think that's a fair reason why this needs to be an attribute.</p>



<a name="204490147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204490147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204490147">(Jul 20 2020 at 22:11)</a>:</h4>
<p>My take here is that traits are the wrong tool for the job, but still maybe better than making a new tool</p>



<a name="204490207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204490207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204490207">(Jul 20 2020 at 22:12)</a>:</h4>
<p>I'm open to revisiting the "propagate by default" behavior for must-safe though</p>



<a name="204490250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204490250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204490250">(Jul 20 2020 at 22:12)</a>:</h4>
<p>Should we make a stream dedicated to this lint? if so, what should I call it? e.g., #wg-async-foundations/yield-safe ? it seems like maybe we have a new name tho</p>



<a name="204490266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204490266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204490266">(Jul 20 2020 at 22:13)</a>:</h4>
<p>(I think a dedicated stream would be nice, though, the conversation seems complex enough to merit it)</p>



<a name="204572207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204572207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204572207">(Jul 21 2020 at 16:47)</a>:</h4>
<p>I tried changing the name of the stream to must_not_await lint, but I don't have the permissions to be able to do so.</p>



<a name="204573449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204573449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204573449">(Jul 21 2020 at 16:57)</a>:</h4>
<p>just changed it</p>



<a name="204580473"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204580473" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204580473">(Jul 21 2020 at 17:55)</a>:</h4>
<p>actually nevermind.. that only changed the topic of the last message, so I put it back</p>



<a name="204580501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204580501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204580501">(Jul 21 2020 at 17:55)</a>:</h4>
<p>not sure how to edit the topic of all messages like that</p>



<a name="204580648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204580648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204580648">(Jul 21 2020 at 17:56)</a>:</h4>
<p>but yeah I do think a stream would make sense personally. "must_not_await lint" seems like a reasonable name</p>



<a name="204678572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204678572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204678572">(Jul 22 2020 at 15:09)</a>:</h4>
<p><span class="user-mention" data-user-id="137147">@Didrik Nordstrom</span> you mentioned you were interested in those benchmarks? I'd actually like to create new benchmarks around different types of shared state in async programs. Something to provide numbers on when to use one over the other. Let me know if you're interested in collaborating on that.</p>



<a name="204720240"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204720240" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Didrik Nordstrom <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204720240">(Jul 22 2020 at 20:42)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> Sounds great. I'm invested in a very similar project in Fuchsia, in particular because we are paying for atomics and syscalls that are not necessary for single-threaded executors, which we use a lot of. So I'll be focusing more on the single-vs-multithreaded case.</p>



<a name="204721235"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/204721235" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#204721235">(Jul 22 2020 at 20:50)</a>:</h4>
<p>Yeah, I am interested in probably the opposite use case but I want to measure the impact of using different sync primitives for guarding different types of workloads on say a hashmap. So 90%read/10% write, etc</p>



<a name="205829360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/205829360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#205829360">(Aug 03 2020 at 18:24)</a>:</h4>
<p>Can anyone point me towards the implementation of<code>#[must_use]</code>? A cursory search of the rust repo and the rustc dev guide did not yield anything.</p>



<a name="206416121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206416121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206416121">(Aug 09 2020 at 23:19)</a>:</h4>
<p>So going over the <a href="https://github.com/rust-lang/rust/blob/60c2e8d438f75aed5192dfa76e4b42a6739f6291/src/librustc_lint/unused.rs#L217"><code>#[must_use]</code> attribute impl</a>, it looks like we check if an expression evaluates to an item which has been marked as <code>#[must_use]</code>, this could be a <code>Result</code> or anything to which the attribute as been attached. Right now the question I have is:</p>
<ol>
<li>How do we determine if the item hasn't been used? I'm still new to the code, so I might be missing something here</li>
<li>When it comes to holding items across await points, a lint wouldn't be enough, we need to know about the generator state when it is constructed. <span class="user-mention" data-user-id="116883">@tmandry</span> I've read your (excellent) blog post on how the generators are constructed from the <code>async/await</code> keywords, but is it possible for you to walk through what's <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_mir/transform/generator.rs">happening here</a>? If I understand this correctly, this is the code responsible for constructing the generator, so my working theory is that we need to extract information from here and provide it to the lint to use/warn on.</li>
</ol>



<a name="206603569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603569">(Aug 11 2020 at 17:21)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> we could use the MIR info (the end result of which is the <code>GeneratorLayout</code> which is all you need)</p>



<a name="206603598"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603598" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603598">(Aug 11 2020 at 17:21)</a>:</h4>
<p>but, we don't use that for any kind of type checking today</p>



<a name="206603694"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603694" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603694">(Aug 11 2020 at 17:22)</a>:</h4>
<p>instead we use the HIR analysis</p>



<a name="206603719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603719">(Aug 11 2020 at 17:22)</a>:</h4>
<p>Are you talking about how <code>#[must_use]</code> works?</p>



<a name="206603771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603771">(Aug 11 2020 at 17:23)</a>:</h4>
<p>no, I mean how type checking of generators works today</p>



<a name="206603848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603848">(Aug 11 2020 at 17:24)</a>:</h4>
<p>we calculate all the types which live across a yield point <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/generator_interior.rs">here</a></p>



<a name="206603890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603890">(Aug 11 2020 at 17:24)</a>:</h4>
<p>(this is what the talk niko had scheduled is about)</p>



<a name="206603910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206603910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206603910">(Aug 11 2020 at 17:24)</a>:</h4>
<p>Ah okay. But this isn't necessarily type checking is it? This is more like metadata checking (which is probably a part of the type). Sorry, still wrapping my head around all of this.</p>



<a name="206604017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604017">(Aug 11 2020 at 17:25)</a>:</h4>
<p>Ohhh yeah this file helps a ton. And awesome, I'm looking forward to that talk tomorrow/day after.</p>



<a name="206604020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604020">(Aug 11 2020 at 17:25)</a>:</h4>
<p>well, it's "what HIR thinks is going in the generator" and this analysis will most likely be at the HIR level</p>



<a name="206604228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604228">(Aug 11 2020 at 17:26)</a>:</h4>
<p>the end result of that analysis is you get a <code>GeneratorWitness</code> which you can query for, which has the set of types</p>



<a name="206604306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604306">(Aug 11 2020 at 17:27)</a>:</h4>
<p>Correct me if I understood this wrong: We are using the HIR analysis to figure out which types live across yield points. The end result is a type which can be queried for checking which values live across yield points.</p>



<a name="206604559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604559">(Aug 11 2020 at 17:29)</a>:</h4>
<p>So where is the HIR analysis happening?</p>



<a name="206604764"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604764" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604764">(Aug 11 2020 at 17:31)</a>:</h4>
<p>Something like that, yeah. I don't remember the details right now and am having trouble finding the query</p>



<a name="206604830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206604830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206604830">(Aug 11 2020 at 17:31)</a>:</h4>
<p>so pretty much all the analysis is happening in that file that I linked</p>



<a name="206605012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605012">(Aug 11 2020 at 17:32)</a>:</h4>
<p>awesome, I'll dig through the code to see how the analysis reaches here. Thanks!</p>



<a name="206605038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605038">(Aug 11 2020 at 17:32)</a>:</h4>
<p>we walk the HIR, decide which values we think are being saved across a yield point, and register obligations that typeck knows how to handle</p>



<a name="206605112"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605112" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605112">(Aug 11 2020 at 17:33)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/generator_interior.rs#L186">here</a> is where we make the GeneratorWItness object which holds the list of types</p>



<a name="206605139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605139">(Aug 11 2020 at 17:33)</a>:</h4>
<p>Ah so those visitors are for walking the HIR. I was curious about that</p>



<a name="206605176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605176">(Aug 11 2020 at 17:33)</a>:</h4>
<p>yep</p>



<a name="206605268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605268">(Aug 11 2020 at 17:34)</a>:</h4>
<p>And the actual types are actually being found <a href="https://github.com/rust-lang/rust/blob/master/src/librustc_typeck/check/generator_interior.rs#L162">here</a> right?</p>



<a name="206605369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605369">(Aug 11 2020 at 17:35)</a>:</h4>
<p>yes (after being gathered by the visitor)</p>



<a name="206605543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605543">(Aug 11 2020 at 17:36)</a>:</h4>
<p>Oh okay, so all of this is happening during the type check phase</p>



<a name="206605787"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206605787" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206605787">(Aug 11 2020 at 17:38)</a>:</h4>
<p>So what we currently have is a way to query which types live across yield points. If we can provide data on the types held about weather or not they are <code>must_not_await</code> we can query that at type check time. So my next question is, how can this data be passed on to the lint passing stage.</p>



<a name="206618941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206618941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206618941">(Aug 11 2020 at 19:20)</a>:</h4>
<p>So, I was thinking there was a query that would give you the <code>GeneratorWitness</code> for a given generator, and we could get them from that query, but I may have been mistaken. If not then we'll have to make it so</p>



<a name="206623840"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206623840" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206623840">(Aug 11 2020 at 20:00)</a>:</h4>
<p>That makes sense.</p>



<a name="206836452"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206836452" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206836452">(Aug 13 2020 at 16:16)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> is it possible to annotate the type internally via <code>Ty</code> stating that this type is yield unsafe (what ever we call it) and then in that witness list iterate through and just print a warning if we encounter a type that has this flag set?</p>



<a name="206962818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206962818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206962818">(Aug 14 2020 at 18:40)</a>:</h4>
<p><span class="user-mention" data-user-id="207781">@Lucio Franco</span> you probably want to get the type definition (i.e. the DefId) and hang annotations on <em>that</em></p>



<a name="206962941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/206962941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#206962941">(Aug 14 2020 at 18:41)</a>:</h4>
<p>though it's possible we may end up adding a type flag for this for performance reasons, it isn't what I'd reach for first</p>



<a name="207759135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/207759135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#207759135">(Aug 23 2020 at 06:32)</a>:</h4>
<p>Oh neat, I didn't know that arenas were used in rustc <a href="https://github.com/rust-lang/rust/blob/7e11379f3b4c376fbb9a6c4d44f3286ccc28d149/src/librustc_middle/ty/list.rs#L42">https://github.com/rust-lang/rust/blob/7e11379f3b4c376fbb9a6c4d44f3286ccc28d149/src/librustc_middle/ty/list.rs#L42</a></p>



<a name="207797668"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/207797668" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#207797668">(Aug 24 2020 at 00:03)</a>:</h4>
<p>Please correct me if I'm wrong, but right now, annotations are analyzed as a part of lint passes correct? Is there information on the type in the HIR, I don't see it in the <code>DefId</code> struct, but I'm still going through the code. That's basically the last question to answer for the high level reference level design part of the RFC. Once we answer that question, I'm fairly certain we know the path forward.</p>



<a name="207914236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/207914236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#207914236">(Aug 25 2020 at 00:46)</a>:</h4>
<p>I would think annotations are available on the HIR definition but don't know how to get it off the top of my head :/</p>



<a name="207987026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/207987026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#207987026">(Aug 25 2020 at 16:40)</a>:</h4>
<p>Still, I think there is enough information here that I can wrap up the reference level design part and the RFC should be up for review.</p>



<a name="208260363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/208260363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#208260363">(Aug 27 2020 at 18:54)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> where is the text available now?</p>



<a name="208261179"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/208261179" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#208261179">(Aug 27 2020 at 19:00)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> you likely need to push your changes</p>



<a name="208261314"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/208261314" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lucio Franco <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#208261314">(Aug 27 2020 at 19:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> he's dealing with something at work rn, but he will push the rest of the changes to the draft RFC, then we are going to circle back tomorrow/next week to finish it off and get it in a state ready to submit.</p>



<a name="208363991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/208363991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#208363991">(Aug 28 2020 at 16:19)</a>:</h4>
<p>I've been oncall this week, so I've not been able to spend a lot of time on it unfortunately, but I spent some time digging through the codebase and have a path forward. I have a couple of questions which me and <span class="user-mention" data-user-id="207781">@Lucio Franco</span> plan on working through today.</p>



<a name="208364001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/208364001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#208364001">(Aug 28 2020 at 16:19)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="212598217"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/212598217" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#212598217">(Oct 07 2020 at 18:17)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> looks like there are no new comments on the <code>#[must_not_await]</code> RFC since yesterday. So I'm going to merge it now.</p>



<a name="212600967"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/212600967" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#212600967">(Oct 07 2020 at 18:38)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> sounds good, doing a final pass now</p>



<a name="212605214"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/212605214" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#212605214">(Oct 07 2020 at 19:09)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> okay, done. I had some feedback on the wording in the reference section, but otherwise I think it looks good!</p>



<a name="212605294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/212605294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#212605294">(Oct 07 2020 at 19:10)</a>:</h4>
<p>Awesome, I'll make the changes and merge it by tonight! Thanks again for all the help <span class="user-mention" data-user-id="116883">@tmandry</span></p>



<a name="212605370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/212605370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#212605370">(Oct 07 2020 at 19:10)</a>:</h4>
<p>No problem. Thank you for working on this</p>



<a name="213844470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844470">(Oct 19 2020 at 20:55)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> I reviewed the RFC and I think it reads well</p>



<a name="213844487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844487">(Oct 19 2020 at 20:55)</a>:</h4>
<p>the biggest question for the me is indeed the "unresolved question"</p>



<a name="213844550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844550">(Oct 19 2020 at 20:56)</a>:</h4>
<p>but I agree with the conclusion that this should be solved "together" with <code>#[must_use]</code> and, honestly, it seems orthogonal to me</p>



<a name="213844594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844594">(Oct 19 2020 at 20:56)</a>:</h4>
<p>I'm not sure what the best way is to make lang team folks "aware" of this, i've mentioned it a few times</p>



<a name="213844600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844600">(Oct 19 2020 at 20:56)</a>:</h4>
<p>I'm not sure if it's worth a <em>design meeting</em></p>



<a name="213844619"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213844619" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213844619">(Oct 19 2020 at 20:56)</a>:</h4>
<p>maybe I'll just ping a bunch of them :)</p>



<a name="213949127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/213949127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#213949127">(Oct 20 2020 at 17:05)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> thanks for taking a look. Work has kept me extremely busy so I haven't been able to spend time on the RFC again, but I agree with your conclusions about how the link would work with the <code>#[must_use]</code> lint. </p>
<p>Another data point to consider is that if changing the behavior or <code>#[must_use]</code> would cause breaking changes, we could include it as a part of the next edition release.</p>



<a name="216116504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/216116504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#216116504">(Nov 09 2020 at 17:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span> sorry for being MIA for a while there. I took some time off for a couple of weeks, but I'm back now. I opened the RFC today: <a href="https://github.com/rust-lang/rfcs/pull/3014">https://github.com/rust-lang/rfcs/pull/3014</a> . Looking forward to receiving feedback from the larger community.</p>



<a name="217038621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217038621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217038621">(Nov 17 2020 at 17:57)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="1172">@WG-async-foundations</span> the <code>#[must_not_await]</code> lint RFC (<a href="https://github.com/rust-lang/rfcs/pull/3014">https://github.com/rust-lang/rfcs/pull/3014</a>) has been open for about a week now. I'd love to get more eyes on it.</p>



<a name="217222881"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217222881" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217222881">(Nov 19 2020 at 02:29)</a>:</h4>
<p>Having already reviewed it, I don't have much else to say, but I would like it to get more attention :)</p>



<a name="217223248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217223248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217223248">(Nov 19 2020 at 02:35)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> Actually I think it would be good to link to <a href="https://github.com/rust-lang/wg-async-foundations/issues/19">https://github.com/rust-lang/wg-async-foundations/issues/19</a>, since they are related (although complementary) problems. I see it as a future possibility that will look similar to end users, so it'd be good to mention.</p>



<a name="217301992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217301992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217301992">(Nov 19 2020 at 17:21)</a>:</h4>
<p>Same, I hope it gets more traction. Do I need to tag any specific team to get a review? Given that the async-wg already has a done a review of it, I'm not sure what the process should be like.</p>



<a name="217315465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217315465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217315465">(Nov 19 2020 at 19:05)</a>:</h4>
<p>I added some labels. Maybe <span class="user-mention" data-user-id="116009">@nikomatsakis</span> can help get it on the lang team agenda.</p>



<a name="217335662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/217335662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#217335662">(Nov 19 2020 at 21:53)</a>:</h4>
<p>Nominated</p>



<a name="227310599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/227310599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#227310599">(Feb 22 2021 at 18:03)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> this is a good question <a href="https://github.com/rust-lang/rfcs/pull/3014#discussion_r579733355">https://github.com/rust-lang/rfcs/pull/3014#discussion_r579733355</a> which I'm not entirely sure how to answer. Looking at existing examples of RAII guards, they don't implement with <code>Copy</code> or <code>Clone</code>, and in general, I think they shouldn't implement those types, but I'm not a 100% confident of that statement. </p>
<p>Any thoughts?</p>



<a name="227880799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/227880799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#227880799">(Feb 26 2021 at 04:25)</a>:</h4>
<p><span class="user-mention" data-user-id="248777">@Bhargav Voleti</span> I think the problem goes away if we only support the lint on types directly instead of on functions, and I don't see any use case for supporting it on functions.</p>



<a name="227964990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/227964990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#227964990">(Feb 26 2021 at 17:52)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> I agree limiting the lint only to types solves that problem. If I am understanding this correctly, if a <code>Copy</code> type has the <code>#[must_not_suspend]</code> attribute, that means that the behavior would apply to any copies that are made of it, correct?</p>



<a name="227966114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/227966114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#227966114">(Feb 26 2021 at 17:59)</a>:</h4>
<p>yes, because it applies to any values of that type</p>



<a name="227966645"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/227966645" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#227966645">(Feb 26 2021 at 18:01)</a>:</h4>
<p>Perfect, I just wanted it clarified for my own understanding. I'll update the RFC doc to reflect this.</p>



<a name="230719133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/230719133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#230719133">(Mar 17 2021 at 16:12)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span> the RFC has been in the FCP period for over two weeks now without any activity. Do I need to do something from my end to move it forwards?</p>



<a name="236084984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/236084984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#236084984">(Apr 25 2021 at 18:42)</a>:</h4>
<p>I've started working on implementing the <code>#[must_not_suspend]</code> lint and wanted to discuss the possible approaches. When researching the implementation, I saw two possible ways to go about it:</p>
<ol>
<li>Check for the presence of the <code>#[must_not_suspend]</code> attribute on the type during the <a href="https://github.com/rust-lang/rust/blob/58bdb08947f5b3c18a2fbafc5cf36af7b5677d83/compiler/rustc_typeck/src/check/mod.rs#L634">typechecking of the variables captured by the generator</a>. This would involve querying the <code>Session</code>.</li>
<li>Add a new <a href="https://github.com/rust-lang/rust/blob/58bdb08947f5b3c18a2fbafc5cf36af7b5677d83/compiler/rustc_type_ir/src/lib.rs#L16"><code>TypeFlag</code></a> so that the information can be pre-computed during parsing. I personally think this will be faster than the querying the <code>Session</code>.</li>
</ol>
<p>Thoughts? <span class="user-mention" data-user-id="116883">@tmandry</span> <span class="user-mention" data-user-id="116009">@nikomatsakis</span></p>



<a name="236099273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/236099273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tmandry <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#236099273">(Apr 25 2021 at 22:40)</a>:</h4>
<p>Did we decide that <code>#[must_not_suspend]</code> on <code>T</code> should propagate up to types which include <code>T</code>? If so then a <code>TypeFlag</code> would make sense</p>



<a name="236201743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/187312-wg-async-foundations/topic/yield%20safe%20lint/near/236201743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Bhargav Voleti <a href="https://rust-lang.github.io/zulip_archive/stream/187312-wg-async-foundations/topic/yield.20safe.20lint.html#236201743">(Apr 26 2021 at 16:11)</a>:</h4>
<p><span class="user-mention" data-user-id="116883">@tmandry</span>  I think it was left as an open question with most people leaning towards propagation. Okay, I'll go down the <code>TypeFlag</code> route then.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>